import Utils from "./Utils";

const { ccclass, property } = cc._decorator;

@ccclass
export default class Main extends cc.Component {

    // LIFE-CYCLE CALLBACKS:

    onLoad() {
        // 设置画布随着窗口大小改变而改变
        window.onresize = () => {
            let winSize = cc.size(window.innerWidth, window.innerHeight);
            cc.Canvas.instance.designResolution = winSize;
            this.node.setContentSize(winSize);
        }
        window.onresize(null);

        // 为所有按钮组件设置指针改变的事件
        for (let button of this.node.getComponentsInChildren(cc.Button)) {
            Utils.addCusorPointerEvents(button.node);
        }

    }
}
